package com.hzhr.iot.user.convertor;

import com.hzhr.iot.user.convertor.custom.*;
import com.hzhr.iot.core.util.HzhrTypeUtil;
import com.hzhr.iot.core.util.HzhrJsonUtil;
import java.util.Map;
import com.hzhr.iot.user.model.company.CompanyModel;
import com.hzhr.iot.user.model.company.CompanyPostModel;
import com.hzhr.iot.user.entity.CompanyEntity;
import com.hzhr.iot.user.entity.ext.CompanyEntityExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.hzhr.iot.user.model.company.CompanyModel;
import com.hzhr.iot.user.model.company.CompanyGetModel;
import com.hzhr.iot.user.model.company.CompanyPostModel;
import com.hzhr.iot.user.model.company_basicInfo.Company_BasicInfoModel;
import com.hzhr.iot.user.model.company_basicInfo.Company_BasicInfoGetModel;
import com.hzhr.iot.user.model.company_basicInfo.Company_BasicInfoPostModel;
import com.hzhr.iot.user.model.company_basicInfo.Company_BasicInfoPutModel;
import com.hzhr.iot.user.model.company_name.Company_NameModel;
import com.hzhr.iot.user.model.company_name.Company_NameGetModel;
import com.hzhr.iot.user.queryModel.custom.CompanyCustomQueryModel;

@Component
public class CompanyConvertor {
    @Autowired
    ActionCustomConvertor actionCustomConvertor;
    @Autowired
    ActionInRoleCustomConvertor actionInRoleCustomConvertor;
    @Autowired
    DeptCustomConvertor deptCustomConvertor;
    @Autowired
    OptionsCustomConvertor optionsCustomConvertor;
    @Autowired
    ResourceCustomConvertor resourceCustomConvertor;
    @Autowired
    ResourceInActionCustomConvertor resourceInActionCustomConvertor;
    @Autowired
    RoleCustomConvertor roleCustomConvertor;
    @Autowired
    UserCustomConvertor userCustomConvertor;
    @Autowired
    UserInRoleCustomConvertor userInRoleCustomConvertor;

    public CompanyEntity companyModel2entity(CompanyModel in) {
        //未转换字段: createTime updateUserId isValid outId updateTime state 
        if (in == null) return null;
        CompanyEntity result = new CompanyEntity();

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.string2string(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        result.setType(HzhrTypeUtil.string2string(in.getType()));
        result.setIsAuth(HzhrTypeUtil.string2string(in.getIsAuth()));
        result.setCreateUserId(HzhrTypeUtil.integer2integer(in.getCreateUserId()));
        result.setResourceCode(HzhrTypeUtil.string2string(in.getResourceCode()));
        return result;
    }
    public CompanyEntity companyModel2entity(CompanyModel in, CompanyEntity ori) {
        //未转换字段: createTime updateUserId isValid outId updateTime state 
        if (in == null) return null;
        CompanyEntity result = ori;

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.string2string(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        result.setType(HzhrTypeUtil.string2string(in.getType()));
        result.setIsAuth(HzhrTypeUtil.string2string(in.getIsAuth()));
        result.setCreateUserId(HzhrTypeUtil.integer2integer(in.getCreateUserId()));
        result.setResourceCode(HzhrTypeUtil.string2string(in.getResourceCode()));
        return result;
    }
    public List<CompanyEntity> companyModelList2entityList(List<CompanyModel> in) {
        if (in == null) return null;
        List<CompanyEntity> result = new ArrayList<>();
        for (CompanyModel item : in) {
            result.add(companyModel2entity(item));
        }
        return result;
    }
    public CompanyModel entity2companyModel(CompanyEntity in) {
        //未转换字段: 
        if (in == null) return null;
        CompanyModel result = new CompanyModel();

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.string2string(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        result.setType(HzhrTypeUtil.string2string(in.getType()));
        result.setIsAuth(HzhrTypeUtil.string2string(in.getIsAuth()));
        result.setCreateUserId(HzhrTypeUtil.integer2integer(in.getCreateUserId()));
        result.setResourceCode(HzhrTypeUtil.string2string(in.getResourceCode()));
        return result;
    }
    public List<CompanyModel> entityList2companyModelList(List<CompanyEntity> in) {
        if (in == null) return null;
        List<CompanyModel> result = new ArrayList<>();
        for (CompanyEntity item : in) {
            result.add(entity2companyModel(item));
        }
        return result;
    }
    public CompanyModel ext2companyModel(CompanyEntityExt in) {
        //未转换字段: 
        if (in == null) return null;
        CompanyModel result = new CompanyModel();

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.string2string(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        result.setType(HzhrTypeUtil.string2string(in.getType()));
        result.setIsAuth(HzhrTypeUtil.string2string(in.getIsAuth()));
        result.setCreateUserId(HzhrTypeUtil.integer2integer(in.getCreateUserId()));
        result.setResourceCode(HzhrTypeUtil.string2string(in.getResourceCode()));
        return result;
    }
    public List<CompanyModel> extList2companyModelList(List<CompanyEntityExt> in) {
        if (in == null) return null;
        List<CompanyModel> result = new ArrayList<>();
        for (CompanyEntityExt item : in) {
            result.add(ext2companyModel(item));
        }
        return result;
    }
    public CompanyGetModel extList2companyGetModel(List<CompanyEntityExt> extList, Integer total, Integer changeCount, Map<String, Object> query) {
        List<CompanyModel> modelList = extList2companyModelList(extList);
        if (modelList == null) {
            CompanyGetModel result = new CompanyGetModel();
            result.setTotal(total);
            result.setChangeCount(changeCount);
            return result;
        }

         String _show = HzhrTypeUtil.object2string(query.get("_show"));
         Boolean _show_info = query.get("_show_info") != null ? Boolean.parseBoolean(query.get("_show_info").toString()) : false;

        if (!_show_info) {
            for (CompanyModel model : modelList) {
                model.setName(null);
                model.setShortName(null);
                model.setAddr(null);
                model.setContacts(null);
                model.setPhone(null);
                model.setEmail(null);
                model.setType(null);
                model.setIsAuth(null);
                model.setCreateUserId(null);
                model.setResourceCode(null);
            }
        }

        CompanyGetModel result = new CompanyGetModel();
        if ("one".equals(_show)) {
            if (modelList.size() > 0) {
                result.setModel(modelList.get(0));
            }
         }
        if ("list".equals(_show)) {
            result.setModelList(modelList);
        }
        result.setTotal(total);
        result.setChangeCount(changeCount);
        return result;
    }
    public CompanyGetModel entity2companyGetModel(CompanyEntity entity, Integer total, Integer changeCount, Map<String, Object> query) {
        List<CompanyEntityExt> extList = new ArrayList<>();
        if (entity == null) return extList2companyGetModel(extList, total, changeCount, query);
        extList.add(HzhrJsonUtil.convertObjectType(entity, CompanyEntityExt.class));
        return extList2companyGetModel(extList, total, changeCount, query);
     }
    public CompanyEntity companyPostModel2entity(CompanyPostModel in) {
        //未转换字段: createUserId resourceCode createTime updateUserId isValid outId updateTime id state 
        if (in == null) return null;
        CompanyEntity result = new CompanyEntity();

        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.string2string(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        result.setType(HzhrTypeUtil.string2string(in.getType()));
        result.setIsAuth(HzhrTypeUtil.string2string(in.getIsAuth()));
        return result;
    }
    public CompanyEntity companyPostModel2entity(CompanyPostModel in, CompanyEntity ori) {
        //未转换字段: createUserId resourceCode createTime updateUserId isValid outId updateTime id state 
        if (in == null) return null;
        CompanyEntity result = ori;

        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.string2string(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        result.setType(HzhrTypeUtil.string2string(in.getType()));
        result.setIsAuth(HzhrTypeUtil.string2string(in.getIsAuth()));
        return result;
    }
    public List<CompanyEntity> companyPostModelList2entityList(List<CompanyPostModel> in) {
        if (in == null) return null;
        List<CompanyEntity> result = new ArrayList<>();
        for (CompanyPostModel item : in) {
            result.add(companyPostModel2entity(item));
        }
        return result;
    }
    public CompanyPostModel entity2companyPostModel(CompanyEntity in) {
        //未转换字段: 
        if (in == null) return null;
        CompanyPostModel result = new CompanyPostModel();

        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.string2string(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        result.setType(HzhrTypeUtil.string2string(in.getType()));
        result.setIsAuth(HzhrTypeUtil.string2string(in.getIsAuth()));
        return result;
    }
    public List<CompanyPostModel> entityList2companyPostModelList(List<CompanyEntity> in) {
        if (in == null) return null;
        List<CompanyPostModel> result = new ArrayList<>();
        for (CompanyEntity item : in) {
            result.add(entity2companyPostModel(item));
        }
        return result;
    }
    public CompanyPostModel ext2companyPostModel(CompanyEntityExt in) {
        //未转换字段: 
        if (in == null) return null;
        CompanyPostModel result = new CompanyPostModel();

        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.string2string(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        result.setType(HzhrTypeUtil.string2string(in.getType()));
        result.setIsAuth(HzhrTypeUtil.string2string(in.getIsAuth()));
        return result;
    }
    public List<CompanyPostModel> extList2companyPostModelList(List<CompanyEntityExt> in) {
        if (in == null) return null;
        List<CompanyPostModel> result = new ArrayList<>();
        for (CompanyEntityExt item : in) {
            result.add(ext2companyPostModel(item));
        }
        return result;
    }
    public CompanyEntity company_BasicInfoModel2entity(Company_BasicInfoModel in) {
        //未转换字段: isAuth createUserId resourceCode createTime updateUserId isValid outId updateTime state 
        if (in == null) return null;
        CompanyEntity result = new CompanyEntity();

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.object2string(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        result.setType(HzhrTypeUtil.string2string(in.getType()));
        return result;
    }
    public CompanyEntity company_BasicInfoModel2entity(Company_BasicInfoModel in, CompanyEntity ori) {
        //未转换字段: isAuth createUserId resourceCode createTime updateUserId isValid outId updateTime state 
        if (in == null) return null;
        CompanyEntity result = ori;

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.object2string(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        result.setType(HzhrTypeUtil.string2string(in.getType()));
        return result;
    }
    public List<CompanyEntity> company_BasicInfoModelList2entityList(List<Company_BasicInfoModel> in) {
        if (in == null) return null;
        List<CompanyEntity> result = new ArrayList<>();
        for (Company_BasicInfoModel item : in) {
            result.add(company_BasicInfoModel2entity(item));
        }
        return result;
    }
    public Company_BasicInfoModel entity2company_BasicInfoModel(CompanyEntity in) {
        //未转换字段: 
        if (in == null) return null;
        Company_BasicInfoModel result = new Company_BasicInfoModel();

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.string2long(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        result.setType(HzhrTypeUtil.string2string(in.getType()));
        return result;
    }
    public List<Company_BasicInfoModel> entityList2company_BasicInfoModelList(List<CompanyEntity> in) {
        if (in == null) return null;
        List<Company_BasicInfoModel> result = new ArrayList<>();
        for (CompanyEntity item : in) {
            result.add(entity2company_BasicInfoModel(item));
        }
        return result;
    }
    public Company_BasicInfoModel ext2company_BasicInfoModel(CompanyEntityExt in) {
        //未转换字段: 
        if (in == null) return null;
        Company_BasicInfoModel result = new Company_BasicInfoModel();

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.string2long(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        result.setType(HzhrTypeUtil.string2string(in.getType()));
        return result;
    }
    public List<Company_BasicInfoModel> extList2company_BasicInfoModelList(List<CompanyEntityExt> in) {
        if (in == null) return null;
        List<Company_BasicInfoModel> result = new ArrayList<>();
        for (CompanyEntityExt item : in) {
            result.add(ext2company_BasicInfoModel(item));
        }
        return result;
    }
    public Company_BasicInfoGetModel extList2company_BasicInfoGetModel(List<CompanyEntityExt> extList, Integer total, Integer changeCount, Map<String, Object> query) {
        List<Company_BasicInfoModel> modelList = extList2company_BasicInfoModelList(extList);
        if (modelList == null) {
            Company_BasicInfoGetModel result = new Company_BasicInfoGetModel();
            result.setTotal(total);
            result.setChangeCount(changeCount);
            return result;
        }

         String _show = HzhrTypeUtil.object2string(query.get("_show"));
         Boolean _show_info = query.get("_show_info") != null ? Boolean.parseBoolean(query.get("_show_info").toString()) : false;

        if (!_show_info) {
            for (Company_BasicInfoModel model : modelList) {
                model.setName(null);
                model.setShortName(null);
                model.setAddr(null);
                model.setContacts(null);
                model.setPhone(null);
                model.setEmail(null);
                model.setType(null);
            }
        }

        Company_BasicInfoGetModel result = new Company_BasicInfoGetModel();
        if ("one".equals(_show)) {
            if (modelList.size() > 0) {
                result.setModel(modelList.get(0));
            }
         }
        if ("list".equals(_show)) {
            result.setModelList(modelList);
        }
        result.setTotal(total);
        result.setChangeCount(changeCount);
        return result;
    }
    public Company_BasicInfoGetModel entity2company_BasicInfoGetModel(CompanyEntity entity, Integer total, Integer changeCount, Map<String, Object> query) {
        List<CompanyEntityExt> extList = new ArrayList<>();
        if (entity == null) return extList2company_BasicInfoGetModel(extList, total, changeCount, query);
        extList.add(HzhrJsonUtil.convertObjectType(entity, CompanyEntityExt.class));
        return extList2company_BasicInfoGetModel(extList, total, changeCount, query);
     }
    public CompanyEntity company_BasicInfoPostModel2entity(Company_BasicInfoPostModel in) {
        //未转换字段: isAuth createUserId resourceCode createTime updateUserId isValid outId updateTime id state 
        if (in == null) return null;
        CompanyEntity result = new CompanyEntity();

        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.object2string(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        result.setType(HzhrTypeUtil.string2string(in.getType()));
        return result;
    }
    public CompanyEntity company_BasicInfoPostModel2entity(Company_BasicInfoPostModel in, CompanyEntity ori) {
        //未转换字段: isAuth createUserId resourceCode createTime updateUserId isValid outId updateTime id state 
        if (in == null) return null;
        CompanyEntity result = ori;

        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.object2string(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        result.setType(HzhrTypeUtil.string2string(in.getType()));
        return result;
    }
    public List<CompanyEntity> company_BasicInfoPostModelList2entityList(List<Company_BasicInfoPostModel> in) {
        if (in == null) return null;
        List<CompanyEntity> result = new ArrayList<>();
        for (Company_BasicInfoPostModel item : in) {
            result.add(company_BasicInfoPostModel2entity(item));
        }
        return result;
    }
    public Company_BasicInfoPostModel entity2company_BasicInfoPostModel(CompanyEntity in) {
        //未转换字段: 
        if (in == null) return null;
        Company_BasicInfoPostModel result = new Company_BasicInfoPostModel();

        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.string2long(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        result.setType(HzhrTypeUtil.string2string(in.getType()));
        return result;
    }
    public List<Company_BasicInfoPostModel> entityList2company_BasicInfoPostModelList(List<CompanyEntity> in) {
        if (in == null) return null;
        List<Company_BasicInfoPostModel> result = new ArrayList<>();
        for (CompanyEntity item : in) {
            result.add(entity2company_BasicInfoPostModel(item));
        }
        return result;
    }
    public Company_BasicInfoPostModel ext2company_BasicInfoPostModel(CompanyEntityExt in) {
        //未转换字段: 
        if (in == null) return null;
        Company_BasicInfoPostModel result = new Company_BasicInfoPostModel();

        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.string2long(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        result.setType(HzhrTypeUtil.string2string(in.getType()));
        return result;
    }
    public List<Company_BasicInfoPostModel> extList2company_BasicInfoPostModelList(List<CompanyEntityExt> in) {
        if (in == null) return null;
        List<Company_BasicInfoPostModel> result = new ArrayList<>();
        for (CompanyEntityExt item : in) {
            result.add(ext2company_BasicInfoPostModel(item));
        }
        return result;
    }
    public CompanyEntity company_BasicInfoPutModel2entity(Company_BasicInfoPutModel in) {
        //未转换字段: isAuth createUserId resourceCode createTime updateUserId isValid name outId updateTime id state type 
        if (in == null) return null;
        CompanyEntity result = new CompanyEntity();

        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.object2string(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        return result;
    }
    public CompanyEntity company_BasicInfoPutModel2entity(Company_BasicInfoPutModel in, CompanyEntity ori) {
        //未转换字段: isAuth createUserId resourceCode createTime updateUserId isValid name outId updateTime id state type 
        if (in == null) return null;
        CompanyEntity result = ori;

        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.object2string(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        return result;
    }
    public List<CompanyEntity> company_BasicInfoPutModelList2entityList(List<Company_BasicInfoPutModel> in) {
        if (in == null) return null;
        List<CompanyEntity> result = new ArrayList<>();
        for (Company_BasicInfoPutModel item : in) {
            result.add(company_BasicInfoPutModel2entity(item));
        }
        return result;
    }
    public Company_BasicInfoPutModel entity2company_BasicInfoPutModel(CompanyEntity in) {
        //未转换字段: 
        if (in == null) return null;
        Company_BasicInfoPutModel result = new Company_BasicInfoPutModel();

        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.string2long(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        return result;
    }
    public List<Company_BasicInfoPutModel> entityList2company_BasicInfoPutModelList(List<CompanyEntity> in) {
        if (in == null) return null;
        List<Company_BasicInfoPutModel> result = new ArrayList<>();
        for (CompanyEntity item : in) {
            result.add(entity2company_BasicInfoPutModel(item));
        }
        return result;
    }
    public Company_BasicInfoPutModel ext2company_BasicInfoPutModel(CompanyEntityExt in) {
        //未转换字段: 
        if (in == null) return null;
        Company_BasicInfoPutModel result = new Company_BasicInfoPutModel();

        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        result.setAddr(HzhrTypeUtil.string2string(in.getAddr()));
        result.setContacts(HzhrTypeUtil.string2string(in.getContacts()));
        result.setPhone(HzhrTypeUtil.string2long(in.getPhone()));
        result.setEmail(HzhrTypeUtil.string2string(in.getEmail()));
        return result;
    }
    public List<Company_BasicInfoPutModel> extList2company_BasicInfoPutModelList(List<CompanyEntityExt> in) {
        if (in == null) return null;
        List<Company_BasicInfoPutModel> result = new ArrayList<>();
        for (CompanyEntityExt item : in) {
            result.add(ext2company_BasicInfoPutModel(item));
        }
        return result;
    }
    public CompanyEntity company_NameModel2entity(Company_NameModel in) {
        //未转换字段: createUserId updateUserId isValid updateTime type isAuth resourceCode phone createTime outId state addr contacts email 
        if (in == null) return null;
        CompanyEntity result = new CompanyEntity();

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        return result;
    }
    public CompanyEntity company_NameModel2entity(Company_NameModel in, CompanyEntity ori) {
        //未转换字段: createUserId updateUserId isValid updateTime type isAuth resourceCode phone createTime outId state addr contacts email 
        if (in == null) return null;
        CompanyEntity result = ori;

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        return result;
    }
    public List<CompanyEntity> company_NameModelList2entityList(List<Company_NameModel> in) {
        if (in == null) return null;
        List<CompanyEntity> result = new ArrayList<>();
        for (Company_NameModel item : in) {
            result.add(company_NameModel2entity(item));
        }
        return result;
    }
    public Company_NameModel entity2company_NameModel(CompanyEntity in) {
        //未转换字段: 
        if (in == null) return null;
        Company_NameModel result = new Company_NameModel();

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        return result;
    }
    public List<Company_NameModel> entityList2company_NameModelList(List<CompanyEntity> in) {
        if (in == null) return null;
        List<Company_NameModel> result = new ArrayList<>();
        for (CompanyEntity item : in) {
            result.add(entity2company_NameModel(item));
        }
        return result;
    }
    public Company_NameModel ext2company_NameModel(CompanyEntityExt in) {
        //未转换字段: 
        if (in == null) return null;
        Company_NameModel result = new Company_NameModel();

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setName(HzhrTypeUtil.string2string(in.getName()));
        result.setShortName(HzhrTypeUtil.string2string(in.getShortName()));
        return result;
    }
    public List<Company_NameModel> extList2company_NameModelList(List<CompanyEntityExt> in) {
        if (in == null) return null;
        List<Company_NameModel> result = new ArrayList<>();
        for (CompanyEntityExt item : in) {
            result.add(ext2company_NameModel(item));
        }
        return result;
    }
    public Company_NameGetModel extList2company_NameGetModel(List<CompanyEntityExt> extList, Integer total, Integer changeCount, Map<String, Object> query) {
        List<Company_NameModel> modelList = extList2company_NameModelList(extList);
        if (modelList == null) {
            Company_NameGetModel result = new Company_NameGetModel();
            result.setTotal(total);
            result.setChangeCount(changeCount);
            return result;
        }

         String _show = HzhrTypeUtil.object2string(query.get("_show"));


        Company_NameGetModel result = new Company_NameGetModel();
        if ("one".equals(_show)) {
            if (modelList.size() > 0) {
                result.setModel(modelList.get(0));
            }
         }
        if ("list".equals(_show)) {
            result.setModelList(modelList);
        }
        result.setTotal(total);
        result.setChangeCount(changeCount);
        return result;
    }
    public Company_NameGetModel entity2company_NameGetModel(CompanyEntity entity, Integer total, Integer changeCount, Map<String, Object> query) {
        List<CompanyEntityExt> extList = new ArrayList<>();
        if (entity == null) return extList2company_NameGetModel(extList, total, changeCount, query);
        extList.add(HzhrJsonUtil.convertObjectType(entity, CompanyEntityExt.class));
        return extList2company_NameGetModel(extList, total, changeCount, query);
     }
    public CompanyCustomQueryModel companyService_query2queryModel(Map<String, Object> query) {
        CompanyCustomQueryModel queryModel = new CompanyCustomQueryModel();

        Integer _equal_id = HzhrTypeUtil.object2integer(query.get("_equal_id"));
        if (_equal_id != null) {
            queryModel.setEqual_id(_equal_id);
         }

        String _equal_name = HzhrTypeUtil.object2string(query.get("_equal_name"));
        if (_equal_name != null) {
            queryModel.setEqual_name(_equal_name);
         }

        String _equal_shortName = HzhrTypeUtil.object2string(query.get("_equal_shortName"));
        if (_equal_shortName != null) {
            queryModel.setEqual_shortName(_equal_shortName);
         }

        String _equal_type = HzhrTypeUtil.object2string(query.get("_equal_type"));
        if (_equal_type != null) {
            queryModel.setEqual_type(_equal_type);
         }

        Integer _equal_createUserId = HzhrTypeUtil.object2integer(query.get("_equal_createUserId"));
        if (_equal_createUserId != null) {
            queryModel.setEqual_createUserId(_equal_createUserId);
         }

        List _in_id = HzhrTypeUtil.object2list(query.get("_in_id"));
        if (_in_id != null) {
            queryModel.setIn_id(_in_id);
         }

        Boolean _show_info = HzhrTypeUtil.object2boolean(query.get("_show_info"));
        if (_show_info != null && _show_info) {
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
        }

        Integer page = HzhrTypeUtil.object2integer(query.get("_page"));
        Integer count = HzhrTypeUtil.object2integer(query.get("_count"));
        queryModel.setPage(page, count);

        return queryModel;
    }
    public CompanyCustomQueryModel company_BasicInfoService_query2queryModel(Map<String, Object> query) {
        CompanyCustomQueryModel queryModel = new CompanyCustomQueryModel();

        Boolean _show_info = HzhrTypeUtil.object2boolean(query.get("_show_info"));
        if (_show_info != null && _show_info) {
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
        }

        Integer page = HzhrTypeUtil.object2integer(query.get("_page"));
        Integer count = HzhrTypeUtil.object2integer(query.get("_count"));
        queryModel.setPage(page, count);

        return queryModel;
    }
    public CompanyCustomQueryModel company_NameService_query2queryModel(Map<String, Object> query) {
        CompanyCustomQueryModel queryModel = new CompanyCustomQueryModel();

        Integer _equal_id = HzhrTypeUtil.object2integer(query.get("_equal_id"));
        if (_equal_id != null) {
            queryModel.setEqual_id(_equal_id);
         }

        String _equal_name = HzhrTypeUtil.object2string(query.get("_equal_name"));
        if (_equal_name != null) {
            queryModel.setEqual_name(_equal_name);
         }

        String _equal_shortName = HzhrTypeUtil.object2string(query.get("_equal_shortName"));
        if (_equal_shortName != null) {
            queryModel.setEqual_shortName(_equal_shortName);
         }

        String _equal_type = HzhrTypeUtil.object2string(query.get("_equal_type"));
        if (_equal_type != null) {
            queryModel.setEqual_type(_equal_type);
         }

        Integer _equal_createUserId = HzhrTypeUtil.object2integer(query.get("_equal_createUserId"));
        if (_equal_createUserId != null) {
            queryModel.setEqual_createUserId(_equal_createUserId);
         }

        List _in_id = HzhrTypeUtil.object2list(query.get("_in_id"));
        if (_in_id != null) {
            queryModel.setIn_id(_in_id);
         }

        queryModel.setShow(true);
        queryModel.setShow(true);

        Integer page = HzhrTypeUtil.object2integer(query.get("_page"));
        Integer count = HzhrTypeUtil.object2integer(query.get("_count"));
        queryModel.setPage(page, count);

        return queryModel;
    }

}

